//
//  limitFreeTableViewCell.m
//  A段项目,漫画
//
//  Created by dllo on 15/4/22.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "limitFreeTableViewCell.h"
#define WIDTH [[UIScreen mainScreen] bounds].size.width
//#define HEIGHT 210
@implementation limitFreeTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.mainTitle = [[UILabel alloc] init];
        [self.contentView addSubview:self.mainTitle];
        [self.mainTitle release];
        
        self.limitTitle = [[UILabel alloc] init];
        [self.contentView addSubview:self.limitTitle];
        [self.limitTitle release];
        
        self.artistName = [[UILabel alloc] init];
        [self.contentView addSubview:self.artistName];
        [self.artistName release];
        
        self.grade_ave = [[UILabel alloc] init];
        [self.contentView addSubview:self.grade_ave];
        [self.grade_ave release];
        
        self.brief_intrd = [[UILabel alloc] init];
        [self.contentView addSubview:self.brief_intrd];
        [self.brief_intrd release];
        
        self.limitImage = [[UIImageView alloc] init];
        [self.contentView addSubview:self.limitImage];
        [self.limitImage release];
    }
    return self;
}

-(void)layoutSubviews{
    [super layoutSubviews];
    CGFloat bili = 280.0 / 210;
    self.mainTitle.frame = CGRectMake(0, 0, 40, WIDTH / 3 * bili);
    self.mainTitle.font = [UIFont systemFontOfSize:24];
    self.mainTitle.textAlignment = NSTextAlignmentCenter;
    self.mainTitle.numberOfLines = 0;
    self.mainTitle.backgroundColor = [UIColor colorWithRed:244 / 255.0 green:244 / 255.0 blue:244 / 255.0 alpha:1];
    self.mainTitle.layer.borderWidth = 5;
    self.mainTitle.layer.cornerRadius = 20;
    self.mainTitle.layer.borderColor = [UIColor clearColor].CGColor;
    
    //210  280
    self.limitImage.frame = CGRectMake(40, 0, WIDTH / 3, WIDTH / 3 * bili);
    self.limitImage.layer.masksToBounds = YES;
    self.limitImage.layer.borderWidth = 1;
    self.limitImage.layer.cornerRadius = 15;
    self.limitImage.layer.borderColor = [UIColor clearColor].CGColor;
    
    
    
    self.limitTitle.frame = CGRectMake(45 + WIDTH / 3, 0, WIDTH - (40 + WIDTH / 3), WIDTH / 3 * bili / 6);
    self.limitTitle.backgroundColor = [UIColor colorWithRed:244 / 255.0 green:244 / 255.0 blue:244 / 255.0 alpha:1];
    self.limitTitle.font = [UIFont systemFontOfSize:20];
    self.limitTitle.numberOfLines = 0;
    self.limitTitle.textAlignment = NSTextAlignmentCenter;
    self.limitTitle.layer.borderWidth = 5;
    self.limitTitle.layer.cornerRadius = 20;
    self.limitTitle.layer.borderColor = [UIColor clearColor].CGColor;
    
    
    self.artistName.frame = CGRectMake(45 + WIDTH / 3, WIDTH / 3 * bili / 6, WIDTH - (40 + WIDTH / 3), WIDTH / 3 * bili / 6);
    self.artistName.numberOfLines = 0;
    self.artistName.backgroundColor = [UIColor colorWithRed:244 / 255.0 green:244 / 255.0 blue:244 / 255.0 alpha:1];
    
    self.grade_ave.frame = CGRectMake(45 + WIDTH / 3, WIDTH / 3 * bili / 3, WIDTH - (40 + WIDTH / 3), WIDTH / 3 * bili / 6);
    self.grade_ave.backgroundColor = [UIColor colorWithRed:244 / 255.0 green:244 / 255.0 blue:244 / 255.0 alpha:1];
    
    self.brief_intrd.frame = CGRectMake(45 + WIDTH / 3, WIDTH / 3 * bili / 2, WIDTH - (40 + WIDTH / 3), WIDTH / 3 * bili / 2);
    self.brief_intrd.numberOfLines = 0;
    self.brief_intrd.backgroundColor = [UIColor colorWithRed:244 / 255.0 green:244 / 255.0 blue:244 / 255.0 alpha:1];
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
